<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<script src="${ctxWebStatic}/laydate/laydate.js"></script>
<meta name="decorator" content="common_index" />
<head>
	<script>
	$(function(){
		//修改套餐价格小数点后的字体大小
		$('.goodsComboPrice').each(function(){
			var price = $(this).text();
			var split = price.split('.');
			var html = split[0]+"<b>."+split[1]+"</b>";
			$(this).html(html);
		})
		$(".close_img").click(function(){
			$(".topbanner_box").slideUp();
			$(".close_img").hide();
		});
		
		/* setTimeout(function(){
				$(".close_img").hide();
			 	$(".topbanner_box img").animate({height:"0px"},1000, function() {
			 	
		       $(".topbanner_box img").attr("src","${ctxWebStatic}/images/enter_small.png");
		       $(".topbanner_box img").animate({height:"80px"},1000,function(){
		       	$(".close_img").show(100);
		       });
		       
		    });
		},3000) */

		window.onload=function(){
			//轮播图
			var swiper1 = new Swiper('#swpier_one', {
		        pagination: '.swiper-pagination',
		        paginationClickable: true,
		        loop:true,
		        nextButton: '.swiper-button-next',
		    	prevButton: '.swiper-button-prev',
		        //followFinger : false,
		        observer:true,
				observeParents:true
		        //autoplay:3000
		    });
		}
		swiper1.onResize();
		/* $.ajax({
			url:'${ctxWeb}/carousel/selectAllCarousel',
			async:false,
			success:function(result){
				if(result!=null){
					if(result.length>0){
						var html = '';
						html += '<div class="swiper-wrapper" id="banner_list">'
						$(result).each(function(v,e){
							html += '<div class="swiper-slide">'
							html += '<a target="_black" href="'+e.url+'"><img src="${ctxWeb}/web/file/getFile?filePath='+e.img+'" alt="" /></a>'
							html += '</div>'
						})
						html += '</div>'
						$('#swpier_one').html(html);
						//轮播图
						var swiper1 = new Swiper('#swpier_one', {
					        pagination: '.swiper-pagination',
					        paginationClickable: true,
					        loop:true,
					        nextButton: '.swiper-button-next',
					    	prevButton: '.swiper-button-prev',
					        //followFinger : false,
					        observer:true,
							observeParents:true,
					        autoplay:3000
					    });	
						swiper1.onResize();
					}
				}
			}
		}) */
		$(".Recommend_item").hover(function() {
			$(this).addClass('Recommend_item_hover');
		}, function() {
			$(this).removeClass('Recommend_item_hover');
		});
		/* var scrW = $(window).width();
		showItem();
		$(window).on("resize",showItem);
		function showItem(){
			showNum = scrW >= 768 ? showNum = 3: showNum = 1;
			var swiper2 = new Swiper('#swpier_two', {
				nextButton: '.swiper-button-next',
				prevButton: '.swiper-button-prev',
		        slidesPerView: showNum,
		        noSwiping : true,
		        freeMode: true
			});
		} */
	})
	
		function searchIndexFunc(){
			var result="";
			var searchContent=$("#searchContentIndex").val();
			if(searchContent!=""&&searchContent!="请输入搜索关键字"&&searchContent!="请输入商品名、配件编号或厂家编号"){
				result=result+"searchContent="+searchContent;
				window.location.href = "${ctxWeb}/searchGoods/getListByParam?"+result;
			}else{
				return;
			}
		}
	</script>
<title>首页</title>
</head>
<body>

	<!--banner-->
	<div class="banner_rel">
		<div class="swiper-container" id="swpier_one">
			<div class="swiper-wrapper" id="banner_list">
			<c:forEach items="${allCarousels}" var="carousel">
				<div class="swiper-slide">
					<a target="_black" href="${carousel.url }">
						<img src="${ctxWeb}/web/file/getFile?filePath=${carousel.img }" alt="" />
					</a>
				</div>
			</c:forEach>
			</div>
			<div class="swiper-pagination"></div>
			 <!-- Add Pagination -->
		    <div class="swiper-button-prev swiper-button-white"></div>
			<div class="swiper-button-next swiper-button-white"></div>
			
		</div>
		<!--登陆注册-->
		<div class="pc_login_box clearfix">
			<c:choose>
				<c:when test="${webUser == null}">
					<!--未登录-->
					<div class="pc_login clearfix">
						<a href="${ctxWeb}/login">登录</a> 
						<a href="${ctxWeb}/register">注册</a>
					</div>
					<!--未登录结束-->
				</c:when>
				<c:otherwise>
					<c:choose>
						<c:when test="${webUser.userType == 1}">
							<!--登录个人-->
							<div class="pc_login clearfix" style="display: none;">
								<a href="javascript:void(0)"><i class="fa fa-user-o"></i></a> <a
									href="javascript:void(0)" class="font-yellow">认证</a>
							</div>
							<!--登录个人结束-->
						</c:when>
						<c:when test="${webUser.userType == 2}">
							<!--登录企业-->
							<div class="pc_login company_login clearfix"
								style="display: none;">
								<a href="javascript:void(0)"> <i class="fa fa-user-o"></i>
									个人中心
								</a>
							</div>
							<!--登录企业结束-->
						</c:when>
					</c:choose>
				</c:otherwise>
			</c:choose>
			<div class="pc_search_box clearfix">
				<input type="text" placeholder="请输入商品名、配件编号或厂家编号" value="${params.searchContent}" id="searchContentIndex"/> <a
					href="javascript:void(0)" class="pc_search_btn" onclick="searchIndexFunc()"></a>
			</div>
		</div>
		<!--登陆注册结束-->
	</div>
	<!--banner结束-->
	<!--pc端头部-->
	
	<!--推荐-->
	<section class="Recommend_box">
		<div class="container">
			<div class="row clearfix">
				<c:forEach items="${carBrand}" var="bean" >
					<div class="col-xs-6 col-md-3 Recommend_item">
						<a href="${bean.url}" target="_blank"> 
 						<img src="${ctxWeb}/web/file/getFile?filePath=${bean.img}" alt="" />
						</a>
					</div>
				</c:forEach>
			</div>
		</div>
	</section>
	<!--推荐结束-->
	<!--四大保证-->
	<section class="Four_ensure">
		<div class="container">
			<div class="row clearfix">
				<figure class="col-xs-3  col-md-2  col-md-offset-2 Four_ensure_item">
					<img src="${ctxWebStatic}/images/ensure1.png" alt="" />
					<span>正品保证</span>
				</figure>
				<figure class="col-xs-3 col-md-2  Four_ensure_item">
					<img src="${ctxWebStatic}/images/ensure2.png" alt="" />
					<span>价格透明</span>
				</figure>
				<figure class="col-xs-3 col-md-2  Four_ensure_item">
					<img src="${ctxWebStatic}/images/ensure3.png" alt="" />
					<span>品类丰富</span>
				</figure>
				<figure class="col-xs-3 col-md-2  Four_ensure_item">
					<img src="${ctxWebStatic}/images/ensure4.png" alt="" />
					<span>及时配送</span>
				</figure>
			</div>
		</div>
	</section>
	<!--四大保证结束-->
	<%-- <!--套餐-->
	<c:if test="${not empty allGoodsComboList }">
	<section class="Recommend_box">
		<div class="container">
			<div class="row clearfix">
				<!--pc端-->
				<p class="more_tc"><a href="${ctxWeb}/goodsComb/list">更多>></a></p>
				<!--手机端-->
				<a href="${ctxWeb}/goodsComb/list" class="ph_more_tc">
					<span>套餐专区</span>
					<img src="${ctxWebStatic }/images/ph_more.png" alt="" />
				</a>
				<div class="clear"></div>
				<div class="bg_index">
				<div class="swiper-container " id="swpier_two">
				<div class="swiper-wrapper">
					<c:forEach items="${allGoodsComboList }" var="goodsCombo" varStatus="index">
					<div class="swiper-slide">
		            	<div class="item tc_list">
		            	<a href="${ctxWeb}/goodsComb/detail?id=${goodsCombo.id }">
	            			<img src="${ctxWeb}/web/file/getFile?filePath=${goodsCombo.mainPhoto }" alt="" />
						<!--<div class="shop_info">
								<h3>奥迪a6专享套餐</h3>
								<p><span>套餐价：</span><b>¥</b>3820.00</p>
								<a href="#" class="shop_info_two">快速<br />抢购</a>
							</div>-->
	            		</a>
						</div>
					</div>
					</c:forEach>
				</div>
				</div>
				<!-- Add Pagination -->
			    <div class="swiper-button-prev swiper-button-black"></div>
				<div class="swiper-button-next swiper-button-black"></div>
					<div class="swiper-container swiper-container-horizontal swiper-container-free-mode" id="swpier_two">
				        <div class="swiper-wrapper">
				        <c:forEach items="${allGoodsComboList }" var="goodsCombo" varStatus="index">
				            <div class="swiper-slide">
				            	<div class="item tc_list">
									<a href="${ctxWeb}/goodsComb/detail?id=${goodsCombo.id }">
				            			<img src="${ctxWeb}/web/file/getFile?filePath=${goodsCombo.photo }" style="width:260px;height:200px;display:block" alt="" />
				            		</a>
			            			<div class="shop_info" style="position: inherit;">
				            			<a href="${ctxWeb}/goodsComb/detail?id=${goodsCombo.id }">
											<h3>${goodsCombo.name }</h3>
											<p><span>套餐价：</span><b>¥</b><span style="font-size: 24px;color: #fff;" class="goodsComboPrice">${goodsCombo.price }</span></p>
										</a>
										<a href="${ctxWeb }/goodsComb/toGoodsComboOrder?id=${goodsCombo.id}" class="shop_info_two">快速<br />抢购</a>
									</div>
								</div>
							</div>
			        	</c:forEach>
				        </div>
				  		<!-- Add Pagination -->
					    <div class="swiper-button-prev" style="background-image: url(${ctxWebStatic}/images/left.png)">
					    </div>
						<div class="swiper-button-next" style="background-image: url(${ctxWebStatic}/images/right.png)">
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>
	</c:if>
	<!--套餐结束--> --%>
</body>
</html>
